package cn.zhentao.borrow.pojo;

import cn.zhentao.book.pojo.TBook;
import cn.zhentao.user.pojo.TCard;
import cn.zhentao.user.pojo.TUser;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 
 * @TableName t_borrowing
 */
@TableName(value ="t_borrowing")
@Data
public class TBorrowing implements Serializable {
    /**
     * 借阅id
     */
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    /**
     * 借阅用户
     */
    @TableField(value = "user_id")
    private Integer userId;

    /**
     * 借阅的书
     */
    @TableField(value = "book_id")
    private Integer bookId;

    /**
     * 数量
     */
    @TableField(value = "num")
    private Integer num;

    /**
     * 卡片类型
     */
    @TableField(value = "card")
    private Integer card;

    /**
     * 借阅天数
     */
    @TableField(value = "day")
    private Integer day;

    /**
     * 归还时间
     */
    @TableField(value = "return_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime returnTime;

    /**
     * 创建时间
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 修改时间
     */
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 状态（0-未归还 ，1-归还 ，2-续约）
     */
    @TableField(value = "status")
    private Integer status;
    /**
     * 删除状态
     */
//     @TableField(value = "falg")
//     @TableLogic(value = "0",delval = "1")
//     private Integer falg;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private TUser tUser;   //用户

    @TableField(exist = false)
    private TBook tBook;

    @TableField(exist = false)
    private TCard tCard;

    @TableField(exist = false)
    private Integer days;//所剩天数
}